package com.caxxb.controller;

import com.caxxb.entity.User;
import com.caxxb.service.LogService;
import com.caxxb.service.impl.LogServiceImpl;
import com.caxxb.util.PageData;
import com.caxxb.util.QueryResponseData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/log")
public class LogController {
    private LogService logService=new LogServiceImpl();
    @GetMapping("/query")
    @ResponseBody
    public QueryResponseData getNumByPage(@RequestParam(name = "page", required = false, defaultValue = "1") int pageNo, @RequestParam(name = "limit", required = false, defaultValue = "10") int pageSize, @RequestParam(name = "num", required = false, defaultValue = "%%") String num) {

        PageData pageData = logService.getNumByPage(num, pageNo, pageSize);
        QueryResponseData<User> queryResponseData = new QueryResponseData<>();
        //数量
        queryResponseData.setCount(pageData.getTotal());
        queryResponseData.setData(pageData.getData());
        System.out.println(pageData);
        return queryResponseData;
    }


}
